package com.edu.order.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.edu.api.entity.common.ResponseDTO;
import static com.edu.api.entity.common.TimeUtil.getTimeDate;

import com.edu.api.entity.common.TimeUtil;
import com.edu.api.entity.order.PayOrderRecord;
import com.edu.order.service.PayOrderRecordService;
import com.edu.order.mapper.PayOrderRecordMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;


/**
 *
 */
@Service
public class PayOrderRecordServiceImpl extends ServiceImpl<PayOrderRecordMapper, PayOrderRecord>
    implements PayOrderRecordService{

    @Autowired
    private PayOrderRecordMapper payOrderRecordMapper;

    /**
     * 添加订单状态日志表
     * @return
     */
    @Override
    public int addPayOrderRecord(String orderNo,String toStatus, String fromStatus,String name,String price) {
        PayOrderRecord payOrderRecord = new PayOrderRecord();
        payOrderRecord.setOrderNo(orderNo);
        payOrderRecord.setType(toStatus);
        payOrderRecord.setFromStatus(fromStatus);

        payOrderRecord.setToStatus(toStatus);
        payOrderRecord.setCreatedBy(name);
        payOrderRecord.setPaidAmount(Integer.parseInt(price));
        payOrderRecord.setCreatedAt(getTimeDate());
        return payOrderRecordMapper.insert(payOrderRecord);
    }

    @Override
    public ResponseDTO insertOrderRecord(String orderNo,Integer userId,String fromStatus,String toStatus,Integer paidAmount) {
        payOrderRecordMapper.insertOrderRecordCreate(orderNo, userId, fromStatus, toStatus, paidAmount, TimeUtil.getTimeDate());
        return null;
    }
}




